home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / Bonus / VCLZip / kp222_b5.exe / VCLZip.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-07-23  |  14.4 KB  |  419 lines

  1. // Borland C++ Builder
  2. // Copyright (c) 1995, 1999 by Borland International
  3. // All rights reserved
  4.  
  5. // (DO NOT EDIT: machine generated header) 'VCLZip.pas' rev: 5.00
  6.  
  7. #ifndef VCLZipHPP
  8. #define VCLZipHPP
  9.  
  10. #pragma delphiheader begin
  11. #pragma option push -w-
  12. #pragma option push -Vx
  13. #include <kpZcnst.hpp>    // Pascal unit
  14. #include <kpMatch.hpp>    // Pascal unit
  15. #include <kpZipObj.hpp>    // Pascal unit
  16. #include <VCLUnZip.hpp>    // Pascal unit
  17. #include <KpLib.hpp>    // Pascal unit
  18. #include <Controls.hpp>    // Pascal unit
  19. #include <Forms.hpp>    // Pascal unit
  20. #include <Dialogs.hpp>    // Pascal unit
  21. #include <Classes.hpp>    // Pascal unit
  22. #include <Messages.hpp>    // Pascal unit
  23. #include <SysUtils.hpp>    // Pascal unit
  24. #include <Windows.hpp>    // Pascal unit
  25. #include <SysInit.hpp>    // Pascal unit
  26. #include <System.hpp>    // Pascal unit
  27.  
  28. //-- user supplied -----------------------------------------------------------
  29.  
  30. namespace Vclzip
  31. {
  32. //-- type declarations -------------------------------------------------------
  33. typedef Word usigned;
  34.  
  35. typedef Word WPos;
  36.  
  37. typedef Word IPos;
  38.  
  39. typedef Byte uch;
  40.  
  41. class DELPHICLASS EInvalidMatch;
  42. class PASCALIMPLEMENTATION EInvalidMatch : public Sysutils::Exception 
  43. {
  44.     typedef Sysutils::Exception inherited;
  45.     
  46. public:
  47.     #pragma option push -w-inl
  48.     /* Exception.Create */ inline __fastcall EInvalidMatch(const AnsiString Msg) : Sysutils::Exception(
  49.         Msg) { }
  50.     #pragma option pop
  51.     #pragma option push -w-inl
  52.     /* Exception.CreateFmt */ inline __fastcall EInvalidMatch(const AnsiString Msg, const System::TVarRec 
  53.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  54.     #pragma option pop
  55.     #pragma option push -w-inl
  56.     /* Exception.CreateRes */ inline __fastcall EInvalidMatch(int Ident)/* overload */ : Sysutils::Exception(
  57.         Ident) { }
  58.     #pragma option pop
  59.     #pragma option push -w-inl
  60.     /* Exception.CreateResFmt */ inline __fastcall EInvalidMatch(int Ident, const System::TVarRec * Args
  61.         , const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { }
  62.     #pragma option pop
  63.     #pragma option push -w-inl
  64.     /* Exception.CreateHelp */ inline __fastcall EInvalidMatch(const AnsiString Msg, int AHelpContext) : 
  65.         Sysutils::Exception(Msg, AHelpContext) { }
  66.     #pragma option pop
  67.     #pragma option push -w-inl
  68.     /* Exception.CreateFmtHelp */ inline __fastcall EInvalidMatch(const AnsiString Msg, const System::TVarRec 
  69.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  70.         ) { }
  71.     #pragma option pop
  72.     #pragma option push -w-inl
  73.     /* Exception.CreateResHelp */ inline __fastcall EInvalidMatch(int Ident, int AHelpContext)/* overload */
  74.          : Sysutils::Exception(Ident, AHelpContext) { }
  75.     #pragma option pop
  76.     #pragma option push -w-inl
  77.     /* Exception.CreateResFmtHelp */ inline __fastcall EInvalidMatch(System::PResStringRec ResStringRec
  78.         , const System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(
  79.         ResStringRec, Args, Args_Size, AHelpContext) { }
  80.     #pragma option pop
  81.     
  82. public:
  83.     #pragma option push -w-inl
  84.     /* TObject.Destroy */ inline __fastcall virtual ~EInvalidMatch(void) { }
  85.     #pragma option pop
  86.     
  87. };
  88.  
  89.  
  90. struct ct_data;
  91. typedef ct_data *ct_dataPtr;
  92.  
  93. struct VCLZip__2
  94. {
  95.     
  96.     union
  97.     {
  98.         struct 
  99.         {
  100.             Word code;
  101.             
  102.         };
  103.         struct 
  104.         {
  105.             Word freq;
  106.             
  107.         };
  108.         
  109.     };
  110. } ;
  111.  
  112. struct VCLZip__3
  113. {
  114.     
  115.     union
  116.     {
  117.         struct 
  118.         {
  119.             Word len;
  120.             
  121.         };
  122.         struct 
  123.         {
  124.             Word dad;
  125.             
  126.         };
  127.         
  128.     };
  129. } ;
  130.  
  131. #pragma pack(push, 1)
  132. struct ct_data
  133. {
  134.     VCLZip__2 fc;
  135.     VCLZip__3 dl;
  136. } ;
  137. #pragma pack(pop)
  138.  
  139. typedef ct_data ct_dataArray[16383];
  140.  
  141. typedef ct_data *ct_dataArrayPtr;
  142.  
  143. typedef ct_data static_ltree_type[288];
  144.  
  145. typedef ct_data *static_ltreePtr;
  146.  
  147. typedef ct_data static_dtree_type[30];
  148.  
  149. typedef ct_data *static_dtreePtr;
  150.  
  151. typedef Byte windowtype[65536];
  152.  
  153. typedef Byte *windowtypePtr;
  154.  
  155. typedef Word prevtype[32768];
  156.  
  157. typedef Word *prevtypePtr;
  158.  
  159. typedef Word headtype[32768];
  160.  
  161. typedef Word *headtypePtr;
  162.  
  163. typedef Byte l_buftype[32768];
  164.  
  165. typedef Byte *l_buftypePtr;
  166.  
  167. typedef Word d_buftype[32768];
  168.  
  169. typedef Word *d_buftypePtr;
  170.  
  171. typedef Byte flag_buftype[4096];
  172.  
  173. typedef Byte *flag_buftypePtr;
  174.  
  175. #pragma option push -b-
  176. enum TZipAction { zaUpdate, zaReplace, zaFreshen };
  177. #pragma option pop
  178.  
  179. typedef void __fastcall (__closure *TStartZipInfo)(System::TObject* Sender, int NumFiles, double TotalBytes
  180.     , Kpzipobj::TEndCentral* &EndCentralRecord, bool &StopNow);
  181.  
  182. typedef void __fastcall (__closure *TStartZipEvent)(System::TObject* Sender, AnsiString FName, Kpzipobj::TZipHeaderInfo* 
  183.     &ZipHeader, bool &Skip);
  184.  
  185. typedef void __fastcall (__closure *TEndZipFileEvent)(System::TObject* Sender, AnsiString FName, int 
  186.     UncompressedSize, int CompressedSize, int CurrentZipSize);
  187.  
  188. typedef void __fastcall (__closure *TDisposeEvent)(System::TObject* Sender, AnsiString FName, bool &
  189.     Skip);
  190.  
  191. typedef void __fastcall (__closure *TDeleteEvent)(System::TObject* Sender, AnsiString FName, bool &Skip
  192.     );
  193.  
  194. typedef void __fastcall (__closure *TNoSuchFileEvent)(System::TObject* Sender, AnsiString FName);
  195.  
  196. typedef void __fastcall (__closure *TZipComplete)(System::TObject* Sender, int FileCount);
  197.  
  198. #pragma option push -b-
  199. enum TUpdateAction { uaReplacing, uaKeeping };
  200. #pragma option pop
  201.  
  202. typedef void __fastcall (__closure *TUpdateEvent)(System::TObject* Sender, TUpdateAction UDAction, int 
  203.     FileIndex);
  204.  
  205. typedef void __fastcall (__closure *TPrepareNextDisk)(System::TObject* Sender, int DiskNum);
  206.  
  207. typedef void __fastcall (__closure *TOnRecursingFile)(System::TObject* Sender, AnsiString FName);
  208.  
  209. class DELPHICLASS TMultiZipInfo;
  210. class PASCALIMPLEMENTATION TMultiZipInfo : public Classes::TPersistent 
  211. {
  212.     typedef Classes::TPersistent inherited;
  213.     
  214. private:
  215.     int FBlockSize;
  216.     int FFirstBlockSize;
  217.     int FSaveOnFirstDisk;
  218.     bool FSaveZipInfo;
  219.     Vclunzip::TMultiMode FMultiMode;
  220.     bool FCheckDiskLabels;
  221.     bool FWriteDiskLabels;
  222.     
  223. public:
  224.     __fastcall TMultiZipInfo(void);
  225.     virtual void __fastcall Assign(Classes::TPersistent* Source);
  226.     
  227. __published:
  228.     __property int BlockSize = {read=FBlockSize, write=FBlockSize, default=1457600};
  229.     __property int FirstBlockSize = {read=FFirstBlockSize, write=FFirstBlockSize, default=1457600};
  230.     __property int SaveOnFirstDisk = {read=FSaveOnFirstDisk, write=FSaveOnFirstDisk, default=0};
  231.     __property bool SaveZipInfoOnFirstDisk = {read=FSaveZipInfo, write=FSaveZipInfo, default=0};
  232.     __property Vclunzip::TMultiMode MultiMode = {read=FMultiMode, write=FMultiMode, default=0};
  233.     __property bool CheckDiskLabels = {read=FCheckDiskLabels, write=FCheckDiskLabels, default=1};
  234.     __property bool WriteDiskLabels = {read=FWriteDiskLabels, write=FWriteDiskLabels, default=1};
  235. public:
  236.         
  237.     #pragma option push -w-inl
  238.     /* TPersistent.Destroy */ inline __fastcall virtual ~TMultiZipInfo(void) { }
  239.     #pragma option pop
  240.     
  241. };
  242.  
  243.  
  244. class DELPHICLASS TVCLZip;
  245. class PASCALIMPLEMENTATION TVCLZip : public Vclunzip::TVCLUnZip 
  246. {
  247.     typedef Vclunzip::TVCLUnZip inherited;
  248.     
  249. private:
  250.     int FPackLevel;
  251.     bool FRecurse;
  252.     bool FDispose;
  253.     bool FStorePaths;
  254.     bool FRelativePaths;
  255.     bool FStoreVolumes;
  256.     TZipAction FZipAction;
  257.     int FBlockSize;
  258.     TMultiZipInfo* FMultiZipInfo;
  259.     bool FStore83Names;
  260.     AnsiString FTempPath;
  261.     bool FSkipIfArchiveBitNotSet;
  262.     bool FResetArchiveBitOnZip;
  263.     Classes::TStrings* FExcludeList;
  264.     Classes::TStrings* FNoCompressList;
  265.     TZipComplete FOnZipComplete;
  266.     TStartZipInfo FOnStartZipInfo;
  267.     TStartZipEvent FOnStartZip;
  268.     TDisposeEvent FOnDisposeFile;
  269.     TEndZipFileEvent FOnEndZip;
  270.     TDeleteEvent FOnDeleteEntry;
  271.     TNoSuchFileEvent FOnNoSuchFile;
  272.     TUpdateEvent FOnUpdate;
  273.     TPrepareNextDisk FOnPrepareNextDisk;
  274.     TOnRecursingFile FOnRecursingFile;
  275.     __int64 AmountWritten;
  276.     __int64 AmountToWrite;
  277.     bool UsingTempFile;
  278.     bool CreatingSFX;
  279.     Kplib::TLFNFileStream* SFXStubFile;
  280.     bool FPreserveStubs;
  281.     bool FAddDirEntries;
  282.     Word FFileOpenMode;
  283.     
  284. protected:
  285.     Classes::TStream* zfile;
  286.     Classes::TStream* IFile;
  287.     Classes::TStream* mfile;
  288.     AnsiString IFileName;
  289.     int isize;
  290.     Kpzipobj::TSortedZip* tmpfiles;
  291.     Kpzipobj::TSortedZip* tmpfiles2;
  292.     Kpzipobj::TEndCentral* tmpecrec;
  293.     Kpzipobj::TZipHeaderInfo* tmpfile_info;
  294.     AnsiString tmpZipName;
  295.     AnsiString mZipName;
  296.     bool Deleting;
  297.     int FileBytes;
  298.     AnsiString SaveNewName;
  299.     ct_data static_ltree[288];
  300.     ct_data static_dtree[30];
  301.     Word bl_count[16];
  302.     int base_dist[30];
  303.     Byte length_code[256];
  304.     Byte dist_code[512];
  305.     int base_length[29];
  306.     bool TRInitialized;
  307.     Byte *window;
  308.     Word *prev;
  309.     Word *head;
  310.     Byte *l_buf;
  311.     Word *d_buf;
  312.     Byte *flag_buf;
  313.     int __fastcall zfwrite(Windows::PByte buf, int item_size, int nb);
  314.     Byte __fastcall zencode(Byte c);
  315.     int __fastcall file_read(Windows::PByte w, Word size);
  316.     void __fastcall CreateTempZip(void);
  317.     int __fastcall Deflate(void);
  318.     int __fastcall ProcessFiles(void);
  319.     bool __fastcall AddFileToZip(AnsiString FName);
  320.     void __fastcall MoveFile(int Index);
  321.     void __fastcall MoveTempFile(void);
  322.     void __fastcall StaticInit(void);
  323.     void __fastcall CryptHead(AnsiString passwrd);
  324.     virtual void __fastcall SetZipName(AnsiString ZName);
  325.     bool __fastcall GetIsModified(void);
  326.     void __fastcall SetMultiZipInfo(TMultiZipInfo* Value);
  327.     virtual bool __fastcall GetCheckDiskLabels(void);
  328.     void __fastcall SetStoreVolumes(bool Value);
  329.     virtual Vclunzip::TMultiMode __fastcall GetMultiMode(void);
  330.     virtual void __fastcall SetCheckDiskLabels(bool Value);
  331.     virtual void __fastcall SetMultiMode(Vclunzip::TMultiMode Value);
  332.     void __fastcall ResetArchiveBit(AnsiString AFileName);
  333.     __int64 __fastcall DiskRoom(void);
  334.     __int64 __fastcall RoomLeft(void);
  335.     void __fastcall NextPart(void);
  336.     void __fastcall LabelDisk(void);
  337.     void __fastcall SaveZipInfoToFile(AnsiString Filename);
  338.     void __fastcall SetDateTime(int Index, System::TDateTime DT);
  339.     void __fastcall SetPathname(int Index, AnsiString Value);
  340.     void __fastcall SetFilename(int Index, AnsiString Value);
  341.     void __fastcall SetStorePaths(bool Value);
  342.     void __fastcall SetRelativePaths(bool Value);
  343.     AnsiString __fastcall TemporaryPath(void);
  344.     void __fastcall SetExcludeList(Classes::TStrings* Value);
  345.     void __fastcall SetNoCompressList(Classes::TStrings* Value);
  346.     bool __fastcall IsInExcludeList(AnsiString N);
  347.     bool __fastcall IsInNoCompressList(AnsiString N);
  348.     virtual void __fastcall Loaded(void);
  349.     
  350. public:
  351.     __fastcall virtual TVCLZip(Classes::TComponent* AOwner);
  352.     __fastcall virtual ~TVCLZip(void);
  353.     virtual void __fastcall Assign(Classes::TPersistent* Source);
  354.     int __fastcall Zip(void);
  355.     int __fastcall DeleteEntries(void);
  356.     void __fastcall SaveModifiedZipFile(void);
  357.     int __fastcall ZipFromStream(Classes::TStream* theStream, AnsiString FName);
  358.     int __fastcall FixZip(AnsiString InputFile, AnsiString OutputFile);
  359.     void __fastcall MakeSFX(AnsiString SFXStub, bool ModHeaders);
  360.     int __fastcall MakeNewSFX(AnsiString SFXStub, AnsiString FName, char * Options, int OptionsLen);
  361.     int __fastcall ZipFromBuffer(char * Buffer, int Amount, AnsiString FName);
  362.     void __fastcall SFXToZip(bool DeleteSFX);
  363.     __property System::TDateTime DateTime[int Index] = {read=GetDateTime, write=SetDateTime};
  364.     __property AnsiString FileComment[int Index] = {read=GetFileComment, write=SetFileComment};
  365.     __property AnsiString ZipComment = {read=GetZipComment, write=SetZipComment};
  366.     __property bool IsModified = {read=GetIsModified, nodefault};
  367.     __property bool CheckDiskLabels = {read=GetCheckDiskLabels, write=SetCheckDiskLabels, nodefault};
  368.     __property Vclunzip::TMultiMode MultiMode = {read=GetMultiMode, write=SetMultiMode, nodefault};
  369.     __property AnsiString Pathname[int Index] = {read=GetPathname, write=SetPathname};
  370.     __property AnsiString Filename[int Index] = {read=GetFilename, write=SetFilename};
  371.     __property bool PreserveStubs = {read=FPreserveStubs, write=FPreserveStubs, default=0};
  372.     __property Word FileOpenMode = {read=FFileOpenMode, write=FFileOpenMode, default=64};
  373.     
  374. __published:
  375.     __property int PackLevel = {read=FPackLevel, write=FPackLevel, default=6};
  376.     __property bool Recurse = {read=FRecurse, write=FRecurse, default=0};
  377.     __property bool Dispose = {read=FDispose, write=FDispose, default=0};
  378.     __property bool StorePaths = {read=FStorePaths, write=SetStorePaths, default=0};
  379.     __property bool RelativePaths = {read=FRelativePaths, write=SetRelativePaths, default=0};
  380.     __property bool StoreVolumes = {read=FStoreVolumes, write=SetStoreVolumes, default=0};
  381.     __property TZipAction ZipAction = {read=FZipAction, write=FZipAction, default=0};
  382.     __property TMultiZipInfo* MultiZipInfo = {read=FMultiZipInfo, write=SetMultiZipInfo};
  383.     __property bool Store83Names = {read=FStore83Names, write=FStore83Names, default=0};
  384.     __property AnsiString TempPath = {read=FTempPath, write=FTempPath};
  385.     __property bool SkipIfArchiveBitNotSet = {read=FSkipIfArchiveBitNotSet, write=FSkipIfArchiveBitNotSet
  386.         , default=0};
  387.     __property bool ResetArchiveBitOnZip = {read=FResetArchiveBitOnZip, write=FResetArchiveBitOnZip, default=0
  388.         };
  389.     __property Classes::TStrings* ExcludeList = {read=FExcludeList, write=SetExcludeList};
  390.     __property Classes::TStrings* NoCompressList = {read=FNoCompressList, write=SetNoCompressList};
  391.     __property bool AddDirEntriesOnRecurse = {read=FAddDirEntries, write=FAddDirEntries, default=0};
  392.     __property TStartZipEvent OnStartZip = {read=FOnStartZip, write=FOnStartZip};
  393.     __property TStartZipInfo OnStartZipInfo = {read=FOnStartZipInfo, write=FOnStartZipInfo};
  394.     __property TEndZipFileEvent OnEndZip = {read=FOnEndZip, write=FOnEndZip};
  395.     __property TDisposeEvent OnDisposeFile = {read=FOnDisposeFile, write=FOnDisposeFile};
  396.     __property TDeleteEvent OnDeleteEntry = {read=FOnDeleteEntry, write=FOnDeleteEntry};
  397.     __property TNoSuchFileEvent OnNoSuchFile = {read=FOnNoSuchFile, write=FOnNoSuchFile};
  398.     __property TZipComplete OnZipComplete = {read=FOnZipComplete, write=FOnZipComplete};
  399.     __property TUpdateEvent OnUpdate = {read=FOnUpdate, write=FOnUpdate};
  400.     __property TPrepareNextDisk OnPrepareNextDisk = {read=FOnPrepareNextDisk, write=FOnPrepareNextDisk}
  401.         ;
  402.     __property TOnRecursingFile OnRecursingFile = {read=FOnRecursingFile, write=FOnRecursingFile};
  403. };
  404.  
  405.  
  406. //-- var, const, procedure ---------------------------------------------------
  407. extern PACKAGE void __fastcall Register(void);
  408.  
  409. }    /* namespace Vclzip */
  410. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  411. using namespace Vclzip;
  412. #endif
  413. #pragma option pop    // -w-
  414. #pragma option pop    // -Vx
  415.  
  416. #pragma delphiheader end.
  417. //-- end unit ----------------------------------------------------------------
  418. #endif    // VCLZip
  419.